<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Introduction - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.console.getopt.introduction.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.console.getopt.introduction.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.console.getopt.html">Zend_Console_Getopt</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.console.getopt.html">Zend_Console_Getopt</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.console.getopt.rules.html">Declaring Getopt Rules</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.console.getopt.introduction" class="section"><div class="info"><h1 class="title">Introduction</h1></div>
    

    <p class="para">
        The <span class="classname">Zend_Console_Getopt</span> class helps command-line
        applications to parse their options and arguments.
    </p>

    <p class="para">
        Users may specify command-line arguments when
        they execute your application. These arguments have meaning to the
        application, to change the behavior in some way, or choose resources,
        or specify parameters. Many options have developed customary meaning,
        for example <strong class="command">--verbose</strong> enables extra output from many
        applications. Other options may have a meaning that is different for
        each application. For example, <strong class="command">-c</strong> enables different
        features in <strong class="command">grep</strong>, <strong class="command">ls</strong>, and
        <strong class="command">tar</strong>.
    </p>

    <p class="para">
        Below are a few definitions of terms. Common usage of the terms
        varies, but this documentation will use the definitions below.
    </p>

    <ul class="itemizedlist">
        <li class="listitem">
            <p class="para">
                &quot;argument&quot;: a string that occurs on the command-line
                following the name of the command. Arguments may be
                options or else may appear without an option, to name
                resources on which the command operates.
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                &quot;option&quot;: an argument that signifies that the command
                should change its default behavior in some way.
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                &quot;flag&quot;: the first part of an option, identifies
                the purpose of the option. A flag is preceded
                conventionally by one or two dashes
                (<strong class="command">-</strong> or <strong class="command">--</strong>).
                A single dash precedes a single-character flag
                or a cluster of single-character flags.
                A double-dash precedes a multi-character flag.
                Long flags cannot be clustered.
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                &quot;parameter&quot;: the secondary part of an option; a data value
                that may accompany a flag, if it is applicable to the
                given option. For example, many commands accept a
                <strong class="command">--verbose</strong> option, but typically
                this option has no parameter. However, an option like
                <strong class="command">--user</strong> almost always requires
                a following parameter.
            </p>

            <p class="para">
                A parameter may be given as a separate argument following a
                flag argument, or as part of the same argument string,
                separated from the flag by an equals symbol (<strong class="command">=</strong>).
                The latter form is supported only by long flags.
                For example,
                <strong class="command">-u username</strong>, <strong class="command">--user username</strong>,
                and <strong class="command">--user=username</strong> are forms supported
                by <span class="classname">Zend_Console_Getopt</span>.
            </p>
        </li>

        <li class="listitem">
            <p class="para">
                &quot;cluster&quot;: multiple single-character flags combined
                in a single string argument and preceded by a single
                dash. For example, &quot;<strong class="command">ls -1str</strong>&quot;
                uses a cluster of four short flags. This command is
                equivalent to &quot;<strong class="command">ls -1 -s -t -r</strong>&quot;.
                Only single-character flags can be clustered.
                You cannot make a cluster of long flags.
            </p>
        </li>
    </ul>

    <p class="para">
        For example, in <strong class="command">mysql --user=root mydatabase</strong>,
        <strong class="command">mysql</strong> is a <em class="emphasis">command</em>,
        <strong class="command">--user=root</strong> is an <em class="emphasis">option</em>,
        <strong class="command">--user</strong> is a <em class="emphasis">flag</em>,
        <strong class="command">root</strong> is a <em class="emphasis">parameter</em> to the option,
        and <strong class="command">mydatabase</strong> is an argument but not an option
        by our definition.
    </p>

    <p class="para">
        <span class="classname">Zend_Console_Getopt</span> provides an interface to declare
        which flags are valid for your application, output an error and usage
        message if they use an invalid flag, and report to your application
        code which flags the user specified.
    </p>

    <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Getopt is not an Application Framework</b><br /></span>
        

        <p class="para">
            <span class="classname">Zend_Console_Getopt</span> does <em class="emphasis">not</em>
            interpret the meaning of flags and parameters, nor does this class
            implement application workflow or invoke application code.
            You must implement those actions in your own application code.
            You can use the <span class="classname">Zend_Console_Getopt</span> class to parse
            the command-line and provide object-oriented methods for querying
            which options were given by a user, but code to use this
            information to invoke parts of your application should be in
            another <acronym class="acronym">PHP</acronym> class.
        </p>
    </p></blockquote>

    <p class="para">
        The following sections describe usage of <span class="classname">Zend_Console_Getopt</span>.
    </p>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.console.getopt.html">Zend_Console_Getopt</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.console.getopt.html">Zend_Console_Getopt</a></span><br />
                        <span class="home"><a href="manual.html">Programmer's Reference Guide</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.console.getopt.rules.html">Declaring Getopt Rules</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="manual.html">Programmer's Reference Guide</a></li>
  <li class="header up"><a href="reference.html">Zend Framework Reference</a></li>
  <li class="header up"><a href="zend.console.getopt.html">Zend_Console_Getopt</a></li>
  <li class="active"><a href="zend.console.getopt.introduction.html">Introduction</a></li>
  <li><a href="zend.console.getopt.rules.html">Declaring Getopt Rules</a></li>
  <li><a href="zend.console.getopt.fetching.html">Fetching Options and Arguments</a></li>
  <li><a href="zend.console.getopt.configuration.html">Configuring Zend_Console_Getopt</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>